﻿/********************************************************************************************************
  1. 스토어드명		: SP_CODE_PATTERN_ROLE_CUD
  2. 목적 & 기능		: Pattern Role에 대한 입력,수정,삭제관리 (Cad Code / Part Code / Purchasing Part Code)
  3. 생성일자		: 2014.06.30
  4. 생성자 			: 조범준
  5. Used DB Name	: DB_EDUC
  6. Used DB Table	:
						Create	- STDPATTERN_ROLE a
						Update	- STDPATTERN_ROLE a
						Delete	- STDPATTERN_ROLE a
  7. 실행			:
						SP_CODE_PATTERN_ROLE_CUD 'CREATE_PATTERN_ROLE', '', '', '', '', ''
						SP_CODE_PATTERN_ROLE_CUD 'UPDATE_PATTERN_ROLE', '', '', '', '', ''
						SP_CODE_PATTERN_ROLE_CUD 'DELETE_PATTERN_ROLE', '', '', '', '', ''
 ********************************************************************************************************/
----------------------------------------------------------------------------------------------------------
CREATE OR REPLACE PROCEDURE SP_CODE_PATTERN_ROLE_CUD
(
	iJOBMODE				IN VARCHAR2,
	iOBJECTID				IN NUMBER,
	iPATTERN_OBJECTID		IN NUMBER,
	iPATTERN_SECTION		IN NUMBER,
	iFORMAT					IN VARCHAR2
)
IS
BEGIN
----------------------------------------------------------------------------------------------------------
-- 작업구분
----------------------------------------------------------------------------------------------------------
    IF iJOBMODE = 'CREATE_PATTERN_ROLE' THEN
        GOTO CREATE_PATTERN_ROLE;
    ELSIF iJOBMODE = 'UPDATE_PATTERN_ROLE' THEN
        GOTO UPDATE_PATTERN_ROLE;
    ELSIF iJOBMODE = 'DELETE_PATTERN_ROLE' THEN
        GOTO DELETE_PATTERN_ROLE;
    END IF;

----------------------------------------------------------------------------------------------------------
-- PATTERN ROLE 추가
----------------------------------------------------------------------------------------------------------
<<CREATE_PATTERN_ROLE>>
	INSERT INTO	STDPATTERN_ROLE (OBJECTID, PATTERN_OBJECTID, PATTERN_SECTION, FORMAT)
    VALUES (SEQ_STDPATTERN_ROLE.NEXTVAL, iPATTERN_OBJECTID, iPATTERN_SECTION, iFORMAT);
	RETURN;
----------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------
-- PATTERN ROLE 수정
----------------------------------------------------------------------------------------------------------
<<UPDATE_PATTERN_ROLE>>
	UPDATE	STDPATTERN_ROLE A
	SET		A.PATTERN_OBJECTID	= iPATTERN_OBJECTID,
			A.PATTERN_SECTION	= iPATTERN_SECTION,
			A.FORMAT			= iFORMAT,
			A.MODIFY_DATE		= SYSDATE
	WHERE A.OBJECTID			= iOBJECTID;
	RETURN;
----------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------
-- PATTERN ROLE 삭제
----------------------------------------------------------------------------------------------------------
<<DELETE_PATTERN_ROLE>>
	DELETE FROM	STDPATTERN_ROLE A
	WHERE		A.OBJECTID = iOBJECTID;
	RETURN;
----------------------------------------------------------------------------------------------------------
END SP_CODE_PATTERN_ROLE_CUD;
